package DailyPractice.Day17;

import java.util.Scanner;

/**
 * 杨辉三角的变形
 * @author lumin
 * @date 2022/05/13 18:24
 **/
public class Num1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n<=2)
            System.out.println(-1);
        else if(n%2==1){
            System.out.println(2);
        }else {
            if (n % 4 == 0) {
                System.out.println(3);
            }else {
                System.out.println(4);
            }
        }
    }
}